package com.lidong.lowcode.core.controller.system;

import com.lidong.config.controller.BaseController;
import com.lidong.config.domain.gloabreturn.MyInfo;
import com.lidong.config.domain.gloabreturn.PageInfoVO;
import com.lidong.config.domain.gloabreturn.ResponseInfo;
import com.lidong.lowcode.core.domain.common.CustomParam;
import com.lidong.lowcode.core.domain.system.User;
import com.lidong.lowcode.core.service.system.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author LiDong
 * @version 1.0.0
 * @createTime 2021/12/14 20:32
 */
@Api(tags = "{ user 相关 Controller}")
@RestController
@RequestMapping("/user")
public class UserController extends BaseController {

    @Autowired
    private UserService userService;

    @ApiOperation("用户分页接口")
    @PostMapping("/page")
    public PageInfoVO<User> listUserPage(@RequestBody CustomParam customParam) {
        return userService.listUserPage(customParam);
    }

    @ApiOperation("删除用户")
    @PostMapping("/delete")
    public ResponseInfo<MyInfo> deleteUser(@RequestBody List<Integer> ids) {
        return userService.deleteUser(ids);
    }

    @ApiOperation("新增修改")
    @PostMapping("/insert")
    public ResponseInfo<MyInfo> addOrEditUser() {
        return userService.addOrEditUser(this.getParamMap(request));
    }



}
